package com.example.kafka.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {
    private Integer code;
    private String msg;
    private Integer count;
    private T data;

    public static <T> Result<T> success(T data, Integer count){
        Result<T> r = new Result<T>();
        r.code = 0;
        r.count = count;
        r.msg = "success";
        r.data = data;
        return r;
    }


    public static <T> Result<T> fail(String msg){
        Result<T> r = new Result<T>();
        r.code = 1;
        r.msg = msg;
        return r;
    }



}
